Skip to content

add sideline-flycheck-show-error-id option#17

Merged
jcs090218 merged 2 commits into
emacs-sideline:masterfrom
alberti42:fix/reporting-error-code
May 14, 2026
Merged

add sideline-flycheck-show-error-id option#17
jcs090218 merged 2 commits into
emacs-sideline:masterfrom
alberti42:fix/reporting-error-code

Conversation

@alberti42
Copy link
Copy Markdown
Contributor

Summary

Add an opt-in sideline-flycheck-show-error-id defcustom (default nil).
When non-nil, the rendered sideline message is built via
flycheck-error-format-message-and-id, so the diagnostic ID is appended
in brackets:

Expression value is unused [reportUnusedExpression]

instead of the current

Expression value is unused

The default stays nil, so existing users see no change.

Motivation — companion to lsp-mode#5036

This is the sideline-flycheck companion to
emacs-lsp/lsp-mode#5036,
which appends the same diagnostic code to flymake messages. During the
review of that PR, I stated that flycheck already shows the code, but
you (@jcs090218) showed me a screenshot where no code was visible.

I searched more into it and found that your screenshot was taken in sideline-flycheck,
which renders only flycheck-error-message and therefore drops the ID even though
flycheck-error-id is populated. Previously, I had only tested lsp-ui-sideline
which is alternative to this package.

This PR brings sideline-flycheck in line with what flymake will show
once lsp-mode#5036 lands, and matches the way flycheck-list-errors
already surfaces the ID column.

Changes

  • New defcustom sideline-flycheck-show-error-id (default nil).
  • Render path conditionally switches between flycheck-error-message
    and flycheck-error-format-message-and-id.
  • README.md Variables section lists the new option.

Test plan

  • Default config: sideline output unchanged.
  • (setq sideline-flycheck-show-error-id t): ID appears in brackets
    after the message for LSP-backed diagnostics (verified with
    basedpyright on Python).
  • Parser-level diagnostics that genuinely carry no ID (e.g. "Statements
    must be separated by newlines or semicolons") render unchanged — no
    trailing brackets, no empty [].

alberti42 added 2 commits May 14, 2026 10:58
Append the diagnostic ID to each rendered message via
`flycheck-error-format-message-and-id' when enabled.  Default `nil'
preserves the existing behaviour.

For LSP-backed diagnostics this surfaces codes such as
`reportUnusedExpression' (basedpyright) or `E501' (ruff) alongside the
message — useful for grepping documentation, configuring rule severity,
or writing inline ignore comments like `# pyright: ignore[CODE]'.
@jcs090218 jcs090218 merged commit ceacbb0 into emacs-sideline:master May 14, 2026
12 checks passed
@jcs090218 jcs090218 added the enhancement New feature or request label May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants